#pragma once

#include <unordered_map>
#include "../share/user_define.h"
#include "../../3rd/libjson/json.h"

/*
"id": 1,
"exp": 25,
"hero_lv_limit": 10,
"power_reward": 20,
"max_power": 60,
" max_friend": 30,
"max_vitality": 10
*/

struct LuckyDraw
{
	uint32_t mId;
	uint32_t mDiamondCost;
	uint32_t mBasicRate;
	uint32_t mCommonDifference;
	uint32_t mMidas2;
	uint32_t mMidas5;
	uint32_t mMidas10;

	LuckyDraw()
	{
		Clear();
	}

	void Clear(void)
	{
		mId = 0;
	}
};

class LuckyDrawCacheData
{
public:

	static void CreateInstance(void);
	static LuckyDrawCacheData* GetInstance(void);

	~LuckyDrawCacheData(void);

public:

	bool Initialization(void);

	bool Reload(void);

	LuckyDraw* GetData(uint32_t id);

	bool GetDataJsonString(uint32_t id, Json::Value& _jm);

	uint32_t GetDataCount(void);

private:
	LuckyDrawCacheData(void);

	void Clear(void);

	void AddData(uint32_t id, Json::Value& jm);


private:

	static LuckyDrawCacheData* mInstance;

	std::unordered_map<uint32_t, LuckyDraw*> m_mapCacheData;
	uint32_t m_maxCount;

};

